import { createRouter, createWebHistory,RouteRecordRaw } from 'vue-router'
import Layout from '@/Layout/index.vue';
import children from "pages-generated";
export const asyncRoutes:Array<RouteRecordRaw>=[
    {
        path:'/documentation',
        component:Layout,
        redirect:'/documentatiom/index',
        children:[
           {
                path: 'index',
                name: 'Documentation',
                component: () => import(/* webpackChunkName: "documentation" */ '@/views/documentation/index.vue'),
                meta: {
                    title: 'Documentation',
                    icon: 'documentation',
                    hidden:true
                }
            }
        ]
    },
    {
        path: '/guide',
        component: Layout,
        redirect: '/guide/index',
        children: [
          {
            path: 'index',
            name: 'Guide',
            component: () => import(/* webpackChunkName: "guide" */ '@/views/guide/index.vue'),
            meta: {
              title: 'Guide',
              icon: 'guide',
              activeMenu:'/documentation/index'
            }
          }
        ]
    },
    {
      path: '/system',
      component: Layout,
      redirect: '/system/user',
      meta: {
        title: 'System',
        icon: 'lock',
        alwaysShow:true
      },
      children: [
        {
          path: 'menu',
          component: () => import(/* webpackChunkName: "menu" */ '@/views/system/menu.vue'),
          meta: {
            title: 'Menu Management',
            hidden:true,
          }
        },
        {
          path: 'role',
          component: () => import(/* webpackChunkName: "role" */ '@/views/system/role.vue'),
          meta: {
            title: 'Role Management'
          }
        },
        {
          path: 'user',
          component: () => import(/* webpackChunkName: "user" */ '@/views/system/user.vue'),
          meta: {
            title: 'User Management'
          }
        }
      ]
    },
    {
      path: '/external-link',
      component: Layout,
      children:[
        {
          path: 'https://www.baidu.com/',
          redirect: '/',
          meta: {
            title: 'External Link',
            icon: 'link'
          }
        }
      ]
    },
    {
      path:'/:pathMatch(.*)*',
      redirect:'/404',
      meta:{
        hidden:true
      }
    }
]
export const constantRoutes:Array<RouteRecordRaw>=[
    {
        path:'/',
        component:Layout,
        redirect:'/dashboard',
        children:[
            {
                path:'dashboard',
                name:'dashboard',
                component:()=>import(/* webpackChunkName: "dashboard" */ '@/views/dashboard/index.vue'),
                meta:{
                    title: 'Dashboard',
                    icon:'el-icon-platform-eleme'
                }
            }
        ]
    },
    {
      path:'/redirect',
      component:Layout,
      meta:{
        hidden:true
      },
      children:[
        {
          path:'/redirect/:path(.*)',
          component:()=>import('@/views/redirect/index.vue')
        }
      ]
    },
    {
      path:'/401',
      component:Layout,
      meta:{
        hidden:true
      },
      children:[
        {
          path:'',
          component:()=>import('@/views/error-page/401.vue'),
          meta:{
            title:'401',
            icon:'404',
            hidden:true
          }
        }
      ]
    },
    {
      path:'/404',
      component:()=>import('@/views/error-page/404.vue'),
      meta:{
        hidden:true
      }

    }
]
export const routes = [
    ...constantRoutes,
    ...asyncRoutes
]
const router = createRouter({
    history:createWebHistory(),
    routes
})
export default router

